<!DOCTYPE html>
<html>
<head>
<title>管理员列表</title>
<#include "/header.html">
</head>
<body>
<div id="witapp" v-cloak>
	<div v-show="showList">
		<div class="grid-btn">
			<div class="form-group col-sm-2">
				<input type="text" class="form-control" v-model="q.username" @keyup.enter="query" placeholder="关键字查询">
			</div>
			<a class="btn btn-default" @click="query">查询</a>
			<#if shiro.hasPermission("sys:user:save")>
			<a class="btn btn-success" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
			</#if>
			<#if shiro.hasPermission("sys:user:update")>
			<a class="btn btn-success" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
			</#if>
            <#if shiro.hasPermission("sys:user:update")>
			<a class="btn btn-success" @click="check"><i class="fa fa-user">&nbsp;审核</i></a>
			</#if>
			<#if shiro.hasPermission("sys:user:resetting")>
			<a class="btn btn-success" @click="resetting"><i class="fa fa-lock"></i>&nbsp;重置密码</a>
			</#if>
			<#if shiro.hasPermission("sys:user:delete")>
			<a class="btn btn-success" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
			</#if>
		</div>
	    <table id="jqGrid"></table>
	    <div id="jqGridPager"></div>
    </div>

	<div v-show="!showList" class="panel panel-default">
		<div class="panel-heading">{{title}}</div>
		<form class="form-horizontal" style="width:800px;border:1px dashed #999;border-radius:4px;margin-top:16px;">
			<div class="form-group">
				<div class="col-sm-2 control-label">用户名</div>
				<div class="col-sm-10">
                    <input type="text" v-if="flagAdd" class="form-control" v-model="user.username" id="user_username" placeholder="登录账号"/>
                    <input type="text" v-else class="form-control" v-model="user.username" readonly="readonly" id="user_username" placeholder="登录账号"/>
				</div>
			</div>
			<div class="form-group" v-if="flagAdd">
				<div class="col-sm-2 control-label">登录密码</div>
				<div class="col-sm-10">
					<input type="text" class="form-control" v-model="user.password" placeholder="登录密码"/>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label">电子邮箱</div>
				<div class="col-sm-10">
					<input type="text" class="form-control" v-model="user.email" placeholder="电子邮箱"/>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label">手机号码</div>
				<div class="col-sm-10">
					<input type="text" class="form-control" v-model="user.mobile" id="user_mobile" placeholder="手机号码"/>
				</div>
			</div>
			<div class="form-group" id="div_controller_role">
				<div class="col-sm-2 control-label">分配角色</div>
                <div class="col-sm-10">
                    <div class="col-sm-12" v-for="role in roleList" :key="role.roleId">
                        <label class="radio-inline">
                            <input type="radio" name="roleId" :value="role.roleId" @click="roleOptions(role.options)" v-model="user.roleId"/>{{role.roleName}}
                        </label>
                    </div>
                </div>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label">账号状态</div>
				<label class="radio-inline">
					<input type="radio" name="status" value="0" v-model="user.status"/> 禁用
				</label>
				<label class="radio-inline">
					<input type="radio" name="status" value="1" v-model="user.status"/> 正常
				</label>
                <label class="radio-inline">
					<input type="radio" name="status" value="2" v-model="user.status"/> 待审核
				</label>
			</div>
            <div class="form-group" id="div_proxy_area" style="display:none">
                <div class="col-sm-2 control-label">区域范围</div>
                <div class="col-sm-10" style="padding-left:0px;" id="div_proxy_show">
                    <textarea rows="5" readonly="readonly" id="textarea_selected" style="background:#fff" class="form-control" v-model="user.areaNames" placeholder="选择区域" title="点击选择区域" @click="showAreaTree"></textarea>
                </div>
                <input type="hidden" id="selected_areas"/>
            </div>
            <div class="form-group" style="margin-top:20px;width:800px;margin-left:26px;display:flex;justify-content:center;">
                <input type="button" class="btn btn-success" @click="saveOrUpdate" value="提交" style="margin-right:88px;"/><input type="button" class="btn btn-warning" @click="reload" value="返回"/>
            </div>
		</form>
	</div>
</div>

<!-- 选择部门 -->
<div id="deptLayer" style="display: none;padding:10px;">
	<ul id="deptTree" class="ztree"></ul>
</div>

<!-- 代理区域 -->
<div id="proxyAreaLayer" style="display: none;padding:6px;">
	<ul id="proxyAreaTree" class="ztree">
        <li style="margin-top:2px;"><span>获取数据失败</span></li>
    </ul>
</div>
<script src="${request.contextPath}/statics/js/modules/sys/user.js?_${.now?long}"></script>
</body>
</html>